package com.ksjourney;

import mars.game.core.Config;
import mars.game.core.Sprite;

public class Kimo extends Sprite
{
	
	public static final int NOMAL = 0;
	
	public static final int UP = 1;
	
	public static final int DOWN = 2;
	
	public static final int DISAPPEAR = 3;
	
	private static final int ANIMATION_LENGTH = 6;
	
	public static final int KIMO_0 = R.drawable.img_kimo_0;
	public static final int KIMO_1 = R.drawable.img_kimo_1;
	public static final int KIMO_2 = R.drawable.img_kimo_2;
	public static final int KIMO_3 = R.drawable.img_kimo_3;
	public static final int KIMO_4 = R.drawable.img_kimo_4;
	public static final int KIMO_5 = R.drawable.img_kimo_5;
	
	public static final int[] IMG_KIMO =
	{ KIMO_0, KIMO_1, KIMO_2, KIMO_3, KIMO_4, KIMO_5 };
	
	public static final int[] ANIMATION_NOMAL =
	{ 1, 2, 3 };
	
	public static final int[] ANIMATION_UP =
	{ 0, 4, 5 };
	
	public static final int[] ANIMATION_DOWN =
	{ 5, 4, 0 };
	
	public Kimo(int resId)
	{

		super(ANIMATION_LENGTH, resId);
		this.state = NOMAL;
	}
	
	public static Kimo markKimo()
	{

		Kimo kimo = new Kimo(KIMO_0);
		kimo.setPos(Config.SCREEN_WIDTH / 4, Config.SCREEN_HEIGHT / 3);
		return kimo;
	}
	
	public void addLife(int point)
	{

		// 给主人公加血值，point可以是气球的值
		this.life = this.life + point;
	}
	
	@Override
	public void tick()
	{

		super.tick();
		switch (state)
		{
			case NOMAL:
				this.mAniIndex = ANIMATION_NOMAL[mCounts % ANIMATION_NOMAL.length];
				break;
			
			case UP:
				this.mAniIndex = ANIMATION_UP[mCounts % ANIMATION_UP.length];
				break;
			case DOWN:

				break;
			case DISAPPEAR:

				break;
			
			default:
				break;
		}
		
	}
}
